using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PerkLooting:Perk {
	public static ItemGenerator item;
	static PerkLooting() {
		item=ItemManager.GetGenerator("LootingPerkDrop");
	}

	void DeathEventHandler(object _sender,DeathEventArgs e) {
		Mob sender = _sender as Mob;
		if(sender==Player.instance) return;
		if(Random.Range(0,1f)<0.1f) item.Generate(sender.rigidbody.position);
	}

	protected override void SubscribeEvents() {
		base.SubscribeEvents();
		Mob.Death+=DeathEventHandler;
	}
	protected override void UnSubscribeEvents() {
		base.UnSubscribeEvents();
		Mob.Death-=DeathEventHandler;
	}
}